package 多线程.静态代理设计模式;

import java.time.Year;

/**
 *
 * 模拟婚庆公司代理婚礼
 * 静态代理
 * 接口：
 * 1.真实角色
 * 2.代理角色
 * */
public class StaticProxy {
    public static void main(String[] args) {
        new WeddingCompany(new You()).happyMarry();

        //new Thread(线程对象).start();
    }

}
interface Marry{
    void happyMarry();
}

class You implements Marry{
    @Override
    public void happyMarry() {
        System.out.println("终于等到你。");
    }
}

//代理角色
class WeddingCompany implements Marry{
    //真实角色
    private Marry tom;

    public  WeddingCompany(Marry tom) {
        this.tom = tom;
    }
    @Override
    public void happyMarry() {
        ready();
        this.tom.happyMarry();
        after();
    }

    private void ready() {
        System.out.println("布置");
    }

    private void after() {
        System.out.println("收钱");
    }
}
